]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
stop looking for existing channels manually
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 8 Feb 2011 10:04:22 +0000 (11:04 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 16 Feb 2011 09:09:42 +0000 (10:09 +0100)
Mission-control will give them to you as we have Recover=True on the Observer.

js/ui/telepathyClient.js

index 95313f061acb0ec467a7c64db60f11bc8b27941c..d6e0aa8acc8feb0dbc7106d2438ed4fcf114cddc 100644 (file)
@@ -56,28 +56,12 @@ Client.prototype = {
                                                             Tp.CHANNEL_DISPATCHER_BUS_NAME,
                                                             Tp.CHANNEL_DISPATCHER_OBJECT_PATH);
 
-        // Acquire existing connections. (Needed to make things work
-        // through a restart.)
-        let accountManager = new Telepathy.AccountManager(DBus.session,
-                                                          Tp.ACCOUNT_MANAGER_BUS_NAME,
-                                                          Tp.ACCOUNT_MANAGER_OBJECT_PATH);
-
-        accountManager.GetRemote('ValidAccounts', Lang.bind(this,
-            function (accounts, err) {
-                if (!accounts)
-                    return;
-
-                for (let i = 0; i < accounts.length; i++)
-                    this._gotAccount(accounts[i]);
-            }));
-        accountManager.connect('AccountValidityChanged', Lang.bind(this, this._accountValidityChanged));
-
         // Set up a SimpleObserver, which will call _observeChannels whenever a
         // channel matching its filters is detected.
         // The second argument, recover, means _observeChannels will be run
         // for any existing channel as well.
         let dbus = Tp.DBusDaemon.dup();
-        this._observer = Tp.SimpleObserver.new(dbus, false, 'GnomeShell', true,
+        this._observer = Tp.SimpleObserver.new(dbus, true, 'GnomeShell', true,
                                               Lang.bind(this, this._observeChannels));
 
         // We only care about single-user text-based chats
@@ -130,73 +114,6 @@ Client.prototype = {
         context.accept();
     },
 
-    _accountValidityChanged: function(accountManager, accountPath, valid) {
-        if (!valid) {
-            delete this._accounts[accountPath];
-            // We don't need to clean up connections, sources, etc; they'll
-            // get Closed and cleaned up independently.
-        } else
-            this._gotAccount(accountPath);
-    },
-
-    _gotAccount: function(accountPath) {
-        let account = new Telepathy.Account(DBus.session,
-                                            Tp.ACCOUNT_MANAGER_BUS_NAME,
-                                            accountPath);
-        this._accounts[accountPath] = account;
-        account.GetRemote('Connection', Lang.bind(this,
-            function (connPath, err) {
-                if (!connPath || connPath == '/')
-                    return;
-
-                let connReq = new Telepathy.ConnectionRequests(DBus.session,
-                                                               Telepathy.pathToName(connPath),
-                                                               connPath);
-                connReq.GetRemote('Channels', Lang.bind(this,
-                    function(channels, err) {
-                        if (!channels)
-                            return;
-
-                        this._addChannels(accountPath, connPath, channels);
-                    }));
-
-                contactManager.addConnection(connPath);
-            }));
-    },
-
-    _addChannels: function(accountPath, connPath, channelDetailsList) {
-        for (let i = 0; i < channelDetailsList.length; i++) {
-            let [channelPath, props] = channelDetailsList[i];
-
-            // If this is being called from the startup code then it
-            // won't have passed through our filters, so we need to
-            // check the channel/targetHandle type ourselves.
-
-            let channelType = props[Tp.PROP_CHANNEL_CHANNEL_TYPE];
-            if (channelType != Tp.IFACE_CHANNEL_TYPE_TEXT)
-                continue;
-
-            let targetHandleType = props[Tp.PROP_CHANNEL_TARGET_HANDLE_TYPE];
-            if (targetHandleType != Tp.HandleType.CONTACT &&
-                targetHandleType != Tp.HandleType.NONE)
-                continue;
-
-            let targetHandle = props[Tp.PROP_CHANNEL_TARGET_HANDLE];
-            let targetId = props[Tp.PROP_CHANNEL_TARGET_ID];
-
-            if (this._sources[connPath + ':' + targetHandle])
-                continue;
-
-            let source = new Source(accountPath, connPath, channelPath,
-                                    targetHandle, targetHandleType, targetId);
-            this._sources[connPath + ':' + targetHandle] = source;
-            source.connect('destroy', Lang.bind(this,
-                function() {
-                    delete this._sources[connPath + ':' + targetHandle];
-                }));
-        }
-    },
-
     _presenceChanged: function(contactManager, connPath, handle,
                                type, message) {
         let source = this._sources[connPath + ':' + handle];